import axios from 'axios';

const DEEPSEEK_API_URL = 'https://api.deepseek.com/v1'; // 替换为实际的 DeepSeek API URL
const DEEPSEEK_API_KEY = 'sk-9225dc050cc34acc94d23e5fd092e17f'; // 替换为你的 API Key

// 创建 axios 实例
const deepseekClient = axios.create({
    baseURL: DEEPSEEK_API_URL,
    headers: {
        'Authorization': `Bearer ${DEEPSEEK_API_KEY}`,
        'Content-Type': 'application/json',
    },
    tools : [
        {
            "type": "function",
            "function": {
                "name": "get_weather",
                "description": "获取一个地方的天气，用户说出一个城市名，返回该城市的天气信息",
                "parameters": {
                    "type": "object",
                    "properties": {
                        "location": {
                            "type": "string",
                            "description": "城市和街道",
                        }
                    },
                    "required": ["location"]
                },
            }
        },
    ]
});

/**
 * 调用 DeepSeek API 示例
 * @param {Object} data 请求参数
 * @returns {Promise} API 响应
 */
export const callDeepSeekAPI = async (data) => {
    try {
        const response = await deepseekClient.post('/your-endpoint-path', data); // 替换为实际的 API 路径
        return response.data;
    } catch (error) {
        console.error('DeepSeek API 调用失败:', error);
        throw error;
    }
};